how to get last path from url in javascript

162

how to get last path from url in javascript -

const lastSegmentOfUrl = this.href.substring(this.href.lastIndexOf('/') + 1);

Comments

Submit
0 Comments